<template>
	<div class="addProject business-workAdd">
		<div class="addForm zll-form" v-loading="tableLoading">
			<el-row :gutter="40">
				<el-col :span="8">
					<div class="text-formList">
						<span class="text_left">入库类型：</span>
						<span class="text_right">{{ addForm.storageTypeCn }}</span>
					</div>
					<div class="text-formList">
						<span class="text_left">入库号：</span>
						<span class="text_right">{{ addForm.storageCode }}</span>
					</div>
				</el-col>
				<el-col :span="8">
					<div class="text-formList">
						<span class="text_left">状态：</span>
						<span class="text_right">{{ addForm.storageStatusCn }}</span>
					</div>
					<div class="text-formList">
						<span class="text_left">入库日期：</span>
						<span class="text_right">{{ addForm.createTimeFt }}</span>
					</div>
				</el-col>
				<el-col :span="8">
					<div class="text-formList">
						<span class="text_left">备注：</span>
						<span class="text_right">{{ addForm.remark }}</span>
					</div>
					<div class="text-formList">
						<span class="text_left">入库人：</span>
						<span class="text_right">{{ addForm.storageUserName }}</span>
					</div>
				</el-col>
			</el-row>
			<div class="tableList" style="margin-top: 0;">
				<table border="1">
					<tr>
						<th>序号</th>
						<th>计划号</th>
						<th>品类</th>
						<th>计划名称</th>
						<th width="200">规格</th>
						<th>入库件数</th>
					</tr>
					<tr v-if="tableData.length == 0" class="noData">
						<td colspan="6">暂无数据</td>
					</tr>
					<tr v-else class="add_Table" v-for="(item, index) in tableData" :key="index">
						<td><p>{{ index+1 }}</p></td>
						<td><p>{{ item.planCode }}</p></td>
						<td><p>{{ item.itemName }}</p></td>
						<td><p>{{ item.planName }}</p></td>
						<td width="200"><p>{{ item.gradeValue }}</p></td>
						<td><p>{{ item.storageCount }}</p></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</template>
<script>

	export default {
		props: ['editData', 'type'],
		data() {
			return {
				addForm: {
					id: '',
					storageTypeCn: '',
					storageCode: '',
					storageUserName: '',
					storageCount: '',
					storageGradeCount: '',
					remark: '',
					storageStatusCn: '',
					createTimeFt: '',
				},
				tableLoading: true, //table刷新
				tableData: [],
				tableHeader: [],
			}
		},
		methods: {
			submitForm(val, type) {
				let self = this;
				self.$eventBus.$emit("updateWorkList");
			},

			getProductStorageById(id) {
				let self = this;
				self.tableData = [];
				self.tableLoading  =true;
				self.$http({
					url: "/jinl/productStorage/getProductStorageById",
					method: "post",
					params:{id:id}
				}).then(resp => {
					self.tableLoading = false;
					self.tableHeader = [
						{"columnValue": "planCode", "columnName": "计划号"},
						{"columnValue": "itemName", "columnName": "品类"},
						{"columnValue": "planName", "columnName": "计划名称"},
						{"columnValue": "gradeValue", "columnName": "规格", width: 200},
						{"columnValue": "storageCount", "columnName": "入库数量"},
					];
					if (resp.success) {
						self.addForm = resp.result;
						self.tableData = resp.result.productStorageVos;
					}
				});
			},
		},

		watch:{
			editData(val) {
				console.log('======editData=========')
				console.log(val)
				this.getProductStorageById(val.id);
			},
		},

		mounted() {

		},
		components: {},
	}
</script>
<style lang="scss" scoped>
	@import "@/style/dialog.scss";

	.dc {
		width: 100px;
		background: #e6a23c;
	}
</style>